{__NOLAYOUT__}
<script src="__PUBLIC__/Admin/Js/jquery-1.7.2.min.js" type="text/javascript"></script><link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/Css/address.css" /><script type="text/javascript" src="__PUBLIC__/Home/Js/login_user.js" ></script><script type="text/javascript" src="__PUBLIC__/Home/Js/area.js" ></script><script type="text/javascript" src="__PUBLIC__/Admin/Js/layer.js"></script><link rel="stylesheet" type="text/css" href="__PUBLIC__/Home/Css/commen.css" />

<style>
	.conter-right{
		margin-left:0;
		float:left;
	}
	
</style>
	<div class="conter-right">
		<div class="mid-top">
			<label class="name">

				<a><i>收货人姓名</i><input type="text" id="shname" placeholder="长度不超过12个字" name="name" value="{$result.shname}"></a>
				<a><i>收货人手机号</i><input type="text" name="phone" id="phone" placeholder="输入11位手机号" value="{$result.phone}"></a>	
			</label>
			<label class="site">
				<i>收货人地址</i>

				<td>
						<select id="s_province" name="s_province"></select>  
					    <select id="s_city" name="s_city" ></select>
					    <select id="s_county" name="s_county"></select>
					    <input type="text" id="village" placeholder="乡镇/街道" value="{$result.village}"/>
				</td>
				<div id="show"></div>
				
				
				
			</label>
			<label class="detail-site">
				<i>详细地址</i>
				<input type="text" id="site" placeholder="请输入不超过50个字的详细地址" value="{$result.detail_site}" />
				<input  id="address_id" type="hidden" value="{$result.address_id}"/>
			</label>
			<div class="default">
				
					<if condition="$result['defau']['default_id'] eq $result['address_id']">
						<label class="on" >
						<input type="checkbox" />
					<else/>
						<label>
						<input type="checkbox"/>
					</if>
					
					<span>设为默认</span>
				</label>	
			</div>
			<button id="hold">保存</button>
		</div>
	</div>

<script type="text/javascript">_init_area()</script>
<script type="text/javascript">
    var Gid  = document.getElementById ;
    var showArea = function() {
        Gid('show').innerHTML = "<h3>省" + Gid('s_province').value + " - 市" +    
        Gid('s_city').value + " - 县/区" + 
        Gid('s_county').value + "</h3>"
    }
    Gid('s_county').setAttribute('onchange','showArea()');
</script>
<script type="text/javascript">
$("#hold").click(function(){

		var shname = $("#shname").val();
		var phone = $("#phone").val();
		var province = $("#s_province").val();
		var city = $("#s_city").val();
		var county = $("#s_county").val();
		var village = $("#village").val();
		var site = $("#site").val();
		var address_id = $("#address_id").val();
		var check = $(".mid-top .default label").find("input").is(':checked');
		var defau = 0;//是否默认
		if(check){
			defau = 1;
		}
		$.post("",{shname:shname,phone:phone,province:province,city:city,county:county,village:village,detail_site:site,defau:defau,address_id:address_id},function(data){
			if(data.code == 1){
				layer.alert(data.info,{end:function(){
					window.parent.location.reload();
				}});
			}else{
				layer.alert(data.info);
			}
		})
		return false;
	})


	$(".mid-top .default label").click(function(){
		if($(this).find("input").is(":checked")){
			$(this).addClass("on");
		}else{
			$(this).removeClass("on");
		}
	})


</script>